/* pxmaint.i  - Standard maintenance component include file                   */
/* Copyright 1986-2011 QAD Inc., Santa Barbara, CA, USA.                      */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Id:: pxmaint.i 2301 2010-11-08 07:09:06Z jvz                           $: */
/* $Revision: 1.5 $                                                           */
/*                                                                            */
/* Standard include for maintenance components                                */
/*                                                                            */
/* REVISION: 9.1 BY: Brian Wintz          DATE: 10/22/1999  ECO: *N03S*       */
/* REVISION: 9.1    LAST MODIFIED: 08/17/00 BY: *N0LJ* Mark Brown             */
/* $Revision: 1.5 $  BY:Murali Ayyagari       DATE: 01/30/01    ECO: *N0VB*       */
/*                                                                            */
/*V8:ConvertMode=NoConvert                                                    */
/*V8:RunMode=Character,Windows                                                */

&IF DEFINED(PXMAINT_I)=0 &THEN
&GLOBAL-DEFINE PXMAINT_I

/*Error exception handling and message CONSTANTS*/
{us/px/pxsevcon.i}
{us/px/pxpgmmgr.i}

/*Local Vars*/
define variable toolHandle as handle no-undo.

/*============================================================================*/
/* ****************************  Function Prototypes ************************ */
/*============================================================================*/
FUNCTION getHandle RETURNS handle
  ( input pgmName as character,
    input lockPgm as logical) in pgmMgrHandle.

FUNCTION getProcHandle RETURNS handle
  ( input pgmName as character,
    input lockPgm as logical) in pgmMgrHandle.

FUNCTION boolToChar RETURNS character
  ( input pBooleanVal as logical ) in toolHandle.

FUNCTION charToBool RETURNS logical
  ( input pCharVal as character ) in toolHandle.

FUNCTION charToDate RETURNS date
  ( input pCharVal as character ) in toolHandle.

FUNCTION charToDecimal RETURNS decimal
  ( input pCharVal as character ) in toolHandle.

FUNCTION charToInt RETURNS integer
  ( input pCharVal as character ) in toolHandle.

FUNCTION dateToChar RETURNS character
  ( input pDateVal as date ) in toolHandle.

FUNCTION decimalToChar RETURNS character
  ( input pDecimalVal as decimal ) in toolHandle.

FUNCTION intToChar RETURNS character
  ( input pIntVal as integer ) in toolHandle.

FUNCTION stripDirFromProgName RETURNS character PRIVATE
  ( input pProgramName as character ) FORWARD.

/*============================================================================*/
/* ******************************  Main Block  ****************************** */
/*============================================================================*/

/*GET TOOL AND PROGRAM MANAGER POINTER*/
pgmMgrHandle = getObject(input "pxpgmmgr.p").
toolHandle = getHandle(input "pxtools.p",input true).

/*============================================================================*/
/* ***********************  Standard API Procedures  ************************ */
/*============================================================================*/

/*=============================================================================*/
PROCEDURE setMessage:
/*------------------------------------------------------------------------------
  Purpose:     Standard method for setting a user message
  Exceptions:  CONFIRMATION-RESULT
  Notes: public procedure
</Comment/>
@Interface IMaintenance
setMessage(
   String pContext,
   String pFieldName,
   Integer pMsgNbr,
   Integer pMsgSeverity,
   String pMsgText)
   Standard method for setting a user message.
Parameters
   pContext - context in which message occurred
   pFieldName - name of field associated with message
   pMsgNbr - message number identifier for msg_mstr record
   pMsgSeverity - severity of message
   pMsgText - text to append to end of message
Pre Conditions
   Severity level must be either 1 (informational), 2 (warning) or 3 (error).
   Message number specifies a valid msg_mstr message.
Post Conditions
   If not in API mode displays message, otherwise registers message for processing with outbound message.
</Comment/>
  History:
------------------------------------------------------------------------------*/
   define input parameter pContext     as character no-undo.
   define input parameter pFieldName   as character no-undo.
   define input parameter pMsgNbr      as integer no-undo.
   define input parameter pMsgSeverity as integer no-undo.
   define input parameter pMsgText     as character no-undo.

   do on error undo, return error return-value:

      run setMessage in toolHandle(
         input pContext,
         input pFieldName,
         input pMsgNbr,
         input pMsgSeverity,
         input pMsgText).

   end.

   return {&SUCCESS-RESULT}.
END PROCEDURE.

&ENDIF
